﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

using YunBox2.Contracts.Core;

namespace YunBox2.DAL.Maps
{
    public class UserMap:ClassMap<User>
    {
        public UserMap()
        {
            Id(x => x.Id).GeneratedBy.Guid().Default("(newid())").Column("ID");
            Map(x => x.UserName).Length(16).Column("UserName").Not.Nullable().UniqueKey("UK_UserName");
            Map(x => x.FullName).Length(32).Column("FullName").Default("''");
            Map(x => x.Email).Length(64).Column("Email").Default("'@'");
            Map(x => x.Password).Length(32).Column("Password").Default("''").Not.Nullable();
            Map(x => x.IsRoot).Column("Root").Default("0").Not.Nullable().CustomSqlType("bit");
            Map(x => x.LastChangedPassword);
            Map(x => x.LastLoginTime);
            Map(x => x.LastLogoutTime);
            Map(x => x.LastModifiedTime);
            References(x => x.LastModifiedUser).Column("LastModifiedUserId");
			
			Table("UserProfile");
        }
    }
}
